package com.sui.bigdata.sml.model.configuration;

import com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;
import java.util.List;

/**
 * @author songhaicheng
 * @date 2019/11/12 14:55
 * @description
 * @reviewer
 */
@Configuration
public class DisconfAutoConfig {

    @Bean(name = "disconfConfig", initMethod = "init", destroyMethod = "destroy")
    public ReloadablePropertiesFactoryBean reloadablePropertiesFactoryBean() {
        ReloadablePropertiesFactoryBean bean = new ReloadablePropertiesFactoryBean();
        bean.setEnableDisconf(true);
        // 读取 disconf 该目录下的所有配置
        List<String> paths = Arrays.asList("sml-model/1_0_0_0", "fd-common-authorization/1_0_0_0");
        bean.setPaths(paths);
        return bean;
    }

}
